﻿using Microsoft.Extensions.Configuration;

namespace iTool.Core
{
    public class TestCallServer
    {
        private static ManagerPluginCoreServer pluginsManager;

        static TestCallServer()
        {
            var framework = "appsetting.json";
            // 环境变量
            var builder = new ConfigurationBuilder().AddJsonFile(framework, true, true);
            IConfiguration configuration = builder.Build();
            pluginsManager = new ManagerPluginCoreServer(configuration);
        }

        public static async Task<dynamic> InvokeAsync(PluginRequestBodyParameter request)
        {
            return await pluginsManager.InvokeAsync(request.PluginName, request.ExportMethodName, request.Parameters);
        }
    }
}
